package com.qqtech.qquan.send.model;

import java.sql.Timestamp;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.qqtech.core.common.util.StringUtil;
import com.qqtech.core.common.util.TimeUtil;
import com.qqtech.qquan.send.enums.SendDeliveryUserAuditStatusDictEnum;
import com.qqtech.qquan.send.enums.SendDeliveryUserStatusDictEnum;
import com.qqtech.qquan.user.enums.UserConst;

@SuppressWarnings("serial")
public class SendDeliveryUserVo extends SendDeliveryUser{
	
	/** 昵称 */
	public String userNick;
	
	/** 头像 */
	public String userLogo;
	
	/** 注册时间 */
	public Timestamp registerAt;
	
	/** 帐号 */
	public String identity;
	
	/** 社区名 */
	public String communityName;
	
	/** 上级人的昵称 */
	public String parentNick;
	
	/** 真实姓名 */
	public String realName;
	
	/** 个人正面照 */
	public String userPhotosImg;
	
	/** 上级人真实姓名 */
	public String parentRealName;
	
	public String getParentRealName() {
		return parentRealName;
	}

	public void setParentRealName(String parentRealName) {
		this.parentRealName = parentRealName;
	}

	public String getUserPhotosImg() {
		return userPhotosImg;
	}

	public void setUserPhotosImg(String userPhotosImg) {
		this.userPhotosImg = userPhotosImg;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getUserNick() {
		return userNick;
	}

	public void setUserNick(String userNick) {
		this.userNick = userNick;
	}

	public String getUserLogo() {
		return userLogo;
	}

	public void setUserLogo(String userLogo) {
		this.userLogo = userLogo;
	}

	public Timestamp getRegisterAt() {
		return registerAt;
	}

	public void setRegisterAt(Timestamp registerAt) {
		this.registerAt = registerAt;
	}

	public String getIdentity() {
		return identity;
	}

	public void setIdentity(String identity) {
		this.identity = identity;
	}

	public String getCommunityName() {
		return communityName;
	}

	public void setCommunityName(String communityName) {
		this.communityName = communityName;
	}

	public String getParentNick() {
		return parentNick;
	}

	public void setParentNick(String parentNick) {
		this.parentNick = parentNick;
	}

	public String getStrRegisterAt() {
		return TimeUtil.getStringTimeByFormat(registerAt, "yyyy-MM-dd HH:mm");
	}
	
	public String getStrAuditAt() {
		return TimeUtil.getStringTimeByFormat(getAuditAt(), "yyyy-MM-dd HH:mm");
	}
	
	public String getStrStatus() {
		if (getStatus() == null) {
			return "";
		} else if (getStatus().intValue() == SendDeliveryUserStatusDictEnum.OPEN.getCode()) {
			return "正常";
		} else {
			return "暂停";
		}
	}
	
	public String getStrAuditStatus() {
		if (getAuditStatus() == null) {
			return "";
		} else if (getAuditStatus().intValue() == SendDeliveryUserAuditStatusDictEnum.WAIT.getCode()) {
			return "待审核";
		} else if (getAuditStatus().intValue() == SendDeliveryUserAuditStatusDictEnum.THROUGH.getCode()) {
			return "通过";
		} else {
			return "不通过";
		}
	}
	
	public String getFullUserLogo() {
		if (StringUtil.isBlank(getUserLogo())) {
			return "";
		}
		return super.getImgHandleDomain() + "" + getUserLogo() + UserConst.IMG_POSTFIX;
	}
	
	public String getFullUserPhotosImg() {
		if (StringUtil.isBlank(getUserPhotosImg())) {
			return "";
		}
		return super.getImgHandleDomain() + "" + getUserPhotosImg() + UserConst.IMG_POSTFIX;
	}
	
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this,
				ToStringStyle.MULTI_LINE_STYLE);
	}
}